<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>商品管理</title>
    <%--    样式--%>
    <%@include file="/pages/common/plug_.jsp" %>
    <%--    样式--%>
    <script type="text/javascript">
        $(function () {
            $("a#delClass").click(function () {
                return confirm("你确定要删除" +
                    $(this).parent().parent().find("td:first").text() + "吗?");
            })
        })
    </script>

</head>
<body>
<!-- header -->
<%@include file="/pages/common/success_head.jsp" %>

<div id="header">
    <span class="wel_word">商品管理系统</span>
    <%@include file="/pages/common/navigation_bar.jsp" %>
</div>
<!-- header -->

<!-- body -->
<div id="main">
    <table>
        <tr>
            <td>名称</td>
            <td>价格</td>
            <td>作者</td>
            <td>销量</td>
            <td>库存</td>
            <td colspan="2">操作</td>
        </tr>
        <c:forEach items="${requestScope.page.commodities}" var="commodity">
            <tr>
                <td>${commodity.name}</td>
                <td>${commodity.price}</td>
                <td>${commodity.author}</td>
                <td>${commodity.sales}</td>
                <td>${commodity.stock}</td>
                <td>
                    <a href="${pageScope.Path}/managers/commodityServlet?action=findCommodityById&id=${commodity.id}&pageNo=${requestScope.page.pageNo}">修改</a>
                </td>
                <td><a id="delClass"
                       href="${pageScope.Path}/managers/commodityServlet?action=delete&id=${commodity.id}&pageNo=${requestScope.page.pageNo}">删除</a></td>
            </tr>
        </c:forEach>

        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td><a href="${pageScope.Path}/pages/manager/operationOfCommodity.jsp?pageNo=${requestScope.page.pageTotal}">添加图书</a></td>
        </tr>
    </table>

    <%--    paging--%>
    <%@include file="/pages/common/paging.jsp"%>
    <%--    paging--%>

</div>

<!-- body -->

<!--footer-->
<%@include file="/pages/common/common_footer.jsp" %>
<!--footer-->


</body>
</html>